<script setup lang="ts">
import { ref, defineProps, withDefaults } from "vue";
import { formRules } from "../utils/rule";
import { FormProps } from "../utils/types";
const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    Key: 0,
    Value: 0,
    Name: "",
    Params: "",
    Comment: "",
    UpdateTime: "",
    RowVer: 0
  })
});
const ruleFormRef = ref();
const newFormInline = ref(props.formInline);
function getRef() {
  return ruleFormRef.value;
}
defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="formInline"
    :rules="formRules"
    label-width="120px"
    class="w-full"
  >
    <el-form-item label="种子名称" prop="Name">
      <el-input v-model="newFormInline.Name" placeholder="请输入种子名称" />
    </el-form-item>
    <el-form-item label="种子键" prop="Key">
      <el-input-number
        v-model="newFormInline.Key"
        placeholder="请输入种子键"
        type="number"
      />
    </el-form-item>
    <el-form-item label="种子值" prop="Value">
      <el-input-number
        v-model="newFormInline.Value"
        placeholder="请输入种子值"
      />
    </el-form-item>
    <el-form-item label="行级版本号" prop="RowVer">
      <el-input
        v-model="newFormInline.RowVer"
        placeholder="请输入行级版本号"
        type="number"
      />
    </el-form-item>
    <el-form-item label="种子参数" prop="Params">
      <el-input
        v-model="newFormInline.Params"
        placeholder="请输入种子参数"
        type="textarea"
      />
    </el-form-item>
    <el-form-item label="备注" prop="Comment">
      <el-input
        v-model="newFormInline.Comment"
        type="textarea"
        :maxlength="200"
        show-word-limit
        :rows="4"
        placeholder="请输入备注，最多200字"
      />
    </el-form-item>
  </el-form>
</template>
